package Framework.MQ
{
	import Framework.Serialize.*;
	import flash.events.*;
	import mx.events.*;
	
	public class MessageHead extends Object implements IEventDispatcher
	{
		private var _command:int;
		private var _channelId:int;
		private var _fromIds:Array;
		private var _toIds:Array;
		private var _bindingEventDispatcher:EventDispatcher;
		
		public function MessageHead()
		{
			this._bindingEventDispatcher = new EventDispatcher(IEventDispatcher(this));
		}
		
		public function __write(stream:SerializeStream) : void
		{
			stream.writeSize(this.command);
			SeqHandlerIdHelper.write(stream, this.fromIds);
			SeqHandlerIdHelper.write(stream, this.toIds);
		}
		
		public function __read(stream:SerializeStream) : void
		{
			this.command = stream.readSize();
			this.fromIds = SeqHandlerIdHelper.read(stream);
			this.toIds = SeqHandlerIdHelper.read(stream);
		}
		
		public function get command() : int
		{
			return this._command;
		}
		
		public function set command(param1:int) : void
		{
			var _loc_2:* = this._command;
			if (_loc_2 !== param1)
			{
				this._command = param1;
				if (this.hasEventListener("propertyChange"))
				{
					this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "command", _loc_2, param1));
				}
			}
			
		}
		
		public function get channelId() : int
		{
			return this._channelId;
		}
		
		public function set channelId(param1:int) : void
		{
			var _loc_2:* = this._channelId;
			if (_loc_2 !== param1)
			{
				this._channelId = param1;
				if (this.hasEventListener("propertyChange"))
				{
					this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "channelId", _loc_2, param1));
				}
			}
		}
		
		public function get fromIds() : Array
		{
			return this._fromIds;
		}
		
		public function set fromIds(param1:Array) : void
		{
			var _loc_2:* = this._fromIds;
			if (_loc_2 !== param1)
			{
				this._fromIds = param1;
				if (this.hasEventListener("propertyChange"))
				{
					this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "fromIds", _loc_2, param1));
				}
			}
		}
		
		public function get toIds() : Array
		{
			return this._toIds;
		}
		
		public function set toIds(param1:Array) : void
		{
			var _loc_2:* = this._toIds;
			if (_loc_2 !== param1)
			{
				this._toIds = param1;
				if (this.hasEventListener("propertyChange"))
				{
					this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "toIds", _loc_2, param1));
				}
			}
		}
		
		public function addEventListener(param1:String, param2:Function, param3:Boolean = false, param4:int = 0, param5:Boolean = false) : void
		{
			this._bindingEventDispatcher.addEventListener(param1, param2, param3, param4, param5);
		}
		
		public function dispatchEvent(event:Event) : Boolean
		{
			return this._bindingEventDispatcher.dispatchEvent(event);
		}
		
		public function hasEventListener(param1:String) : Boolean
		{
			return this._bindingEventDispatcher.hasEventListener(param1);
		}
		
		public function removeEventListener(param1:String, param2:Function, param3:Boolean = false) : void
		{
			this._bindingEventDispatcher.removeEventListener(param1, param2, param3);
		}
		
		public function willTrigger(param1:String) : Boolean
		{
			return this._bindingEventDispatcher.willTrigger(param1);
		}
	}
}
